@echo off
chcp 65001 > nul
echo 修复文件编码问题...

:: 确保所有文本文件使用UTF-8编码
for %%f in (*.txt *.md *.py) do (
    echo 处理文件: %%f
    type %%f > temp_file.txt
    move /y temp_file.txt %%f > nul
)

:: 特别处理requirements.txt
if exist requirements.txt (
    echo 特别处理requirements.txt
    echo # 核心依赖> requirements.txt
    echo # 这个模块没有外部依赖，但可以添加测试和文档工具>> requirements.txt
    echo.>> requirements.txt
    echo # 测试依赖>> requirements.txt
    echo pytest^>^=6.0>> requirements.txt
    echo pytest-cov^>^=2.0>> requirements.txt
    echo.>> requirements.txt
    echo # 代码质量>> requirements.txt
    echo black^>^=21.5b2>> requirements.txt
    echo flake8^>^=3.9>> requirements.txt
    echo mypy^>^=0.9>> requirements.txt
    echo.>> requirements.txt
    echo # 文档>> requirements.txt
    echo sphinx^>^=4.0>> requirements.txt
    echo sphinx-rtd-theme^>^=0.5>> requirements.txt
    echo.>> requirements.txt
    echo # 打包>> requirements.txt
    echo twine^>^=3.0>> requirements.txt
    echo wheel^>^=0.36>> requirements.txt
)

echo 编码修复完成!
pause